package com.hellobike.haxing.modules.supplier.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hellobike.haxing.modules.supplier.entity.TSupplierClPro;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * @Description: 供应商商品表
 * @Author: haxing-boot
 * @Date:   2020-01-15
 * @Version: V1.0
 */
public interface TSupplierClProMapper extends BaseMapper<TSupplierClPro> {



    @Update("UPDATE t_supplier_cl_pro SET purchase_price = #{purchasePrice}  " +
            "WHERE sku_id = #{skuId} ")
    void updateClp(@Param("skuId") Long skuId, @Param("purchasePrice") BigDecimal purchasePrice);


    @Update("UPDATE t_supplier_cl_pro SET is_default = #{isDefault}  " +
            "WHERE supplier_id = #{supplierId} and sku_id = #{skuId} ")
    void updateClpDefault(@Param("skuId") Long skuId,@Param("supplierId") Long supplierId, @Param("isDefault") Integer isDefault);


    @Update("UPDATE t_supplier_cl_pro SET " +
            "sku_name =  #{skuName}, " +
            "dimension_values = #{dimensionValues}, " +
            "sku_unit = #{skuUnit}, " +
            "date_produce = #{dateProduce}, " +
            "date_due = #{dateDue} " +
            "WHERE sku_id = #{skuId}")
    void updateClpFromSku(@Param("skuId") Long skuId, @Param("skuName") String skuName,@Param("dimensionValues") String dimensionValues,@Param("skuUnit") String skuUnit,@Param("dateProduce") String dateProduce,@Param("dateDue") String dateDue);

}
